UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T3tux85qYw13DZWKx1GjPOFJae8mkAEk7jcklgWoj4c='
WHERE
key_id = '484f6ced1a834b02525e9664f9f1c6e0fbb455c2f221697ec196601d60d35049'
AND (
token = 'T3tux85qYw13DZWKx1GjPOFJae8mkAEk7jcklgWoj4c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)