UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dBSgAeNdweVS6BDo15Mm4atsmZB+73Sw7SThBHxfow4='
WHERE
key_id = '31977824baf27d45a75f2bc2cd1fe25700eb077744abd4d3549032dbf9b338af'
AND (
token = 'dBSgAeNdweVS6BDo15Mm4atsmZB+73Sw7SThBHxfow4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)