UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WBMQlRyGS9wStSz4z5N/Hnh4H5KeTtTMJ6EgFI9/F28=' 
WHERE 
  key_id = 'f60bf4cdf6459f60728a311610d2c428d72c30e32730b4d9595c4eb0ea8a4742' 
  AND (
    token = 'WBMQlRyGS9wStSz4z5N/Hnh4H5KeTtTMJ6EgFI9/F28=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037