UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JjrXsfPtzC+BPBZRjUAKHf4oBnLOLOOsF7sOFsLFkco=' 
WHERE 
  key_id = '509cbf6963d68b2bd2433af091433dedf778263d518d4e01037b1bdc0ec4a87b' 
  AND (
    token = 'JjrXsfPtzC+BPBZRjUAKHf4oBnLOLOOsF7sOFsLFkco=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026