UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UuoNniLfbE+ZzZz2w6u1DDbHZdTUBddzEeG5WyRsp+4=' 
WHERE 
  key_id = '3996738a7863ef855b11c388ab279427fa3a5cbbe3afea0b2b319141dc3a6579' 
  AND (
    token = 'UuoNniLfbE+ZzZz2w6u1DDbHZdTUBddzEeG5WyRsp+4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036