UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aa9xhNCLtGi0l/+Ct7EiRVV0cbT7m2BKsLML3re5lZQ=' 
WHERE 
  key_id = 'f28a976a06ec99dbc87638fecf9c5003853aee2400c8b695110b3cdbd6bead1c' 
  AND (
    token = 'aa9xhNCLtGi0l/+Ct7EiRVV0cbT7m2BKsLML3re5lZQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037