UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'daPyuE2WqqVyknUzFEvLti1UPMShO/hfq6QHmuzgnCs=' 
WHERE 
  key_id = 'ea1b7f1d52b5e140f3d6b0390526b956004d89eb5264959e86afab748fc41eda' 
  AND (
    token = 'daPyuE2WqqVyknUzFEvLti1UPMShO/hfq6QHmuzgnCs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029