UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BUQOLN5jzeqI1nRrqk/m4IQ0f5/XpZ8IB42UbaHMXFg='
WHERE
key_id = '50c52c7a38221d8d7a954d2554f531e703b3008586048e23073589bc69fc683a'
AND (
token = 'BUQOLN5jzeqI1nRrqk/m4IQ0f5/XpZ8IB42UbaHMXFg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)