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