UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wr4J/xVGyhFzaiJndcruxo9ara8hAs/sA/Ydjmfln4Q='
WHERE
key_id = 'bad365f4041333cedd14e20defd076d9e4024a8aac9a7c6a0d82206347fd6b37'
AND (
token = 'wr4J/xVGyhFzaiJndcruxo9ara8hAs/sA/Ydjmfln4Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)