UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Dk2dm+B1fd0JS1vOCENPlku79PqYErGYcjEfP45CP28=' 
WHERE 
  key_id = 'e89eafe70271f4a923a2c59998c1ed3e9c5ae49fa0284d755274b94f3e8c11a6' 
  AND (
    token = 'Dk2dm+B1fd0JS1vOCENPlku79PqYErGYcjEfP45CP28=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028