UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oQWGlSqViUIRgO96amwYx5lza4II9OIky2k4oB7P0dg='
WHERE
key_id = 'c7189e9eeaef4151e7cbed6366322a63ec84244accc9e6fdaf8246742a829f63'
AND (
token = 'oQWGlSqViUIRgO96amwYx5lza4II9OIky2k4oB7P0dg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)