UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a2E2QmUgeg3w0cojvGyjv6xOkG5ENoDEitUi/8dMXmI='
WHERE
key_id = 'cb2e791e4cd70865921b34280b41462196c685e949cf3f3f4414a3107d4145da'
AND (
token = 'a2E2QmUgeg3w0cojvGyjv6xOkG5ENoDEitUi/8dMXmI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)