UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TPHDvdNBQ7jwcgoCq1Zef0zPzftpvYfX8cF8fHabv8g=' 
WHERE 
  key_id = '37c4362ee98b5186e6ad2b3120c3c8b0eac0df84e61a2d4f06843c22b9e68a45' 
  AND (
    token = 'TPHDvdNBQ7jwcgoCq1Zef0zPzftpvYfX8cF8fHabv8g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037