UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OVXwfrMEnfK+t7Xrl3robashiCRgrtgmpzDZrOq291s=' 
WHERE 
  key_id = '7a97a04e5a9e3cd200591cce797e20687579e7c7ca9392b5ad7b90d7143202f5' 
  AND (
    token = 'OVXwfrMEnfK+t7Xrl3robashiCRgrtgmpzDZrOq291s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019