UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vZ6LH8D/UM5femwsM9NzFiNgZB7NznmxFOQw1zyaKI4='
WHERE
key_id = 'b1fa1fd1fead7d4f98917b45c2a61b5d5ca41650ff297a44eb38627ef54758dc'
AND (
token = 'vZ6LH8D/UM5femwsM9NzFiNgZB7NznmxFOQw1zyaKI4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)