UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H83xiQIB2rNCEHiZVaXfvvEGNf5SemhHQBfKkVATpYs=' 
WHERE 
  key_id = '3c7328e568f51ddc02debd35fa58fa191acc87ca1769e48716afc7e107c75a82' 
  AND (
    token = 'H83xiQIB2rNCEHiZVaXfvvEGNf5SemhHQBfKkVATpYs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055