UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dD/hZN03iINdqMtAGaw2GdNJ0u8tHtgO+Ogvz6M2DL8=' 
WHERE 
  key_id = '82e5b5357b2dbbaf8ca5fb30b26ae0317feedaeaea25771584d9d3feabd46849' 
  AND (
    token = 'dD/hZN03iINdqMtAGaw2GdNJ0u8tHtgO+Ogvz6M2DL8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028