UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GyaHk8l4djPfio1UnLUMffnMvLuyXmsK/lCn4LbjKcE=' 
WHERE 
  key_id = '342d75b57a45ec67f5bc931bd252dfbe441af52ce14090ac5c9d6175cd7acdea' 
  AND (
    token = 'GyaHk8l4djPfio1UnLUMffnMvLuyXmsK/lCn4LbjKcE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035