UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j+SCWOD/dsWB/tluNMJnqrplnoUn+ITJrHwPld4aC2Q=' 
WHERE 
  key_id = '01daef7868fdf5c981bd7f19ceb277fda9665f98fada015eb5769681cb0c99b6' 
  AND (
    token = 'j+SCWOD/dsWB/tluNMJnqrplnoUn+ITJrHwPld4aC2Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040