UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XaMb0KxOL90VFEJa6AdAtZkuwKFSCikE/D11hHNpnB4='
WHERE
key_id = '0a3f29991034daef6ca0bb026c40ffa8e66c4f4574d3382b5f3a59ebeb6d535a'
AND (
token = 'XaMb0KxOL90VFEJa6AdAtZkuwKFSCikE/D11hHNpnB4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)