UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1k8X0DxptqbTfwPdd+Qi+2i3w6OB2vqRfB9oMpZjLSw='
WHERE
key_id = 'c52c04273ad8df4127e615acfe54b5bf868ee0cb2fcb9ef229480215de560f55'
AND (
token = '1k8X0DxptqbTfwPdd+Qi+2i3w6OB2vqRfB9oMpZjLSw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)