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