UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dsTDE5Q2HS4Gs0gYenV4cMpU+tOGpN/cOrbuXHuDBQk='
WHERE
key_id = '1e5c4ccd710af14e76869634f3f3271b9beaaa67135783a47df4255115f35b97'
AND (
token = 'dsTDE5Q2HS4Gs0gYenV4cMpU+tOGpN/cOrbuXHuDBQk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)