UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kNyaYdPTIha5Hz56i5CUYKyzWL+VcpAe4z2BHOW+5EI='
WHERE
key_id = '398c873624b13bb8be811b9ffdca693e6256d9c8ad6e71958808da36f6d0165c'
AND (
token = 'kNyaYdPTIha5Hz56i5CUYKyzWL+VcpAe4z2BHOW+5EI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)