UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LvCmt3clzKkIZQ9xWgYF/csEnfh9mfDFiIjNna07LF8='
WHERE
key_id = '31c467cbd0c457562613ad5e0255d3ae12faa0e9af7185db206b521f279aaba0'
AND (
token = 'LvCmt3clzKkIZQ9xWgYF/csEnfh9mfDFiIjNna07LF8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)