UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f7kne8884xIs7mIvyhZm+EqRIDeEDK4bPKYhcIMZjOU=' 
WHERE 
  key_id = '6d9addb1a8dae650bf0b66538e8cf0b82bc003e74d8d6ee74aa7e668db1dc901' 
  AND (
    token = 'f7kne8884xIs7mIvyhZm+EqRIDeEDK4bPKYhcIMZjOU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040