UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XYEVG+BHh8yPms5egeTliXm5XxSxGkrEwcWPhQYW5Ds='
WHERE
key_id = 'a8e09319f56ee552df830ed7d23941b4f3d587d8f3f82634d82b6b660488c326'
AND (
token = 'XYEVG+BHh8yPms5egeTliXm5XxSxGkrEwcWPhQYW5Ds='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)