UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N5fj55R+8d0UKed0DOv5gK8LwKHuQW3xJLun3fT43s8='
WHERE
key_id = 'c0479d36767aef8308d2d287d1f169106c6e24c7009689a53fa25635c6e3d091'
AND (
token = 'N5fj55R+8d0UKed0DOv5gK8LwKHuQW3xJLun3fT43s8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)