UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bEJYPhjnGr+SykHT7G4Q6xkGVQZ//ta55PqJGMR2W7E=' 
WHERE 
  key_id = '0d17fd144e5b878d9dbd7804a883809b3bfe9ba0d3e8d47f1d3080008e70279a' 
  AND (
    token = 'bEJYPhjnGr+SykHT7G4Q6xkGVQZ//ta55PqJGMR2W7E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029