UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4Z02xjY6wsHOVUEQQVrSTLtFAZ/BMki1SVAO9+c0I1E='
WHERE
key_id = 'e1d4171c34f0a40eb8c84419381cb795cdb977730eae0bae23d4c927bbf46228'
AND (
token = '4Z02xjY6wsHOVUEQQVrSTLtFAZ/BMki1SVAO9+c0I1E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)