UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SjqYi6+utGOaYiOa3YT2bbdNk47jSfvTDbd4gjMVajk='
WHERE
key_id = '09aa450271d614ad6722ecc8ac8e1fd57355eeece1e1a4e8d6f97ab884516e38'
AND (
token = 'SjqYi6+utGOaYiOa3YT2bbdNk47jSfvTDbd4gjMVajk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)