UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OLXUMXWUKWPXI4EW1h0Irzi25vWE0FNillId9qqzmyA=' 
WHERE 
  key_id = '9c0983096641773ddb029d7915df992292f3b4d3f4c49f0bf0b160013132c7eb' 
  AND (
    token = 'OLXUMXWUKWPXI4EW1h0Irzi25vWE0FNillId9qqzmyA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046