UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DvHbJQDUctbQ376IN5hchmocPQi5SQ7cpGRFmFhgF78='
WHERE
key_id = '6d91246edfbf8a36d02d07df12fc8d1ae3201f32717faffca214da3480d96745'
AND (
token = 'DvHbJQDUctbQ376IN5hchmocPQi5SQ7cpGRFmFhgF78='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)