UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kpyeL7FutnvGNKqwHKLc8Ic8elwZxj2nDBS2GbKJzi8='
WHERE
key_id = 'df987718b8135c7843cf4c86e4d0dfe4228e2fb4c24da2b870ddc5f0d5158310'
AND (
token = 'kpyeL7FutnvGNKqwHKLc8Ic8elwZxj2nDBS2GbKJzi8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)