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