UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm2Xyzi+JP+2qbP82FUw9gA1ehnMh33CnJfwpz7iEiI8=' 
WHERE 
  key_id = '517575aa879b4edb87d5eaad7ea4026d131dbea18ed6b358d02183cdbd53afd7' 
  AND (
    token = 'm2Xyzi+JP+2qbP82FUw9gA1ehnMh33CnJfwpz7iEiI8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019