UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Si1jQsE62eYp+D/CzOiadiwwnkV4loa0u7FEQDoo1jA=' 
WHERE 
  key_id = '493df17f292046c23af3bfd870495e520faef613f78ded4752d255a74681afbb' 
  AND (
    token = 'Si1jQsE62eYp+D/CzOiadiwwnkV4loa0u7FEQDoo1jA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051