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