UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G1H0OyMGXZ+STLWjn8+5O/WPZX/Z6ysojIEgzvsc3kU='
WHERE
key_id = '59b5ac671104ff76bee63a9b47d78ed939d1d7b9c39d0cc180c82af2ef9fc504'
AND (
token = 'G1H0OyMGXZ+STLWjn8+5O/WPZX/Z6ysojIEgzvsc3kU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)