UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QeR53qntEJF/9tzy4h7D5Q5lhNd19nQ6swcg+5LbfE8='
WHERE
key_id = 'e4739a702bc57244c5d325021a1539206551208e5812dfa299a51f8e453c344a'
AND (
token = 'QeR53qntEJF/9tzy4h7D5Q5lhNd19nQ6swcg+5LbfE8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)