UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oEd7ltm3cA6U160znNDcD/a+15QVXX7Cg82W6NCvxDU='
WHERE
key_id = '1df220b18af99c3aa72e192e9271c85859170694b2c1d4c52ef177b6f9da41d3'
AND (
token = 'oEd7ltm3cA6U160znNDcD/a+15QVXX7Cg82W6NCvxDU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)