UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M433PrBHdfLmsi9Fq+gnRH2oYAl9XYvrtFmxnK7DVew=' 
WHERE 
  key_id = '6c76df4e740c20d421e6fd0c9d9043a0cd19afb922b7669847ddb710876e2242' 
  AND (
    token = 'M433PrBHdfLmsi9Fq+gnRH2oYAl9XYvrtFmxnK7DVew=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038