UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qY9O0cg0QN12o1+SR9ggA6lRvFCYmW3qMbCIsoQfTC4='
WHERE
key_id = 'd2d8bf481a2aa9478f298c8f44c043652c76d7d39370b98624142e3b541cdb55'
AND (
token = 'qY9O0cg0QN12o1+SR9ggA6lRvFCYmW3qMbCIsoQfTC4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)