UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qiLTCTUMtRV6Sf9TGeSMIAosFRsc8qpG53cGCL53GSk='
WHERE
key_id = '333c0a8dc7461308ad134b6047bc5fad2179ac614d87ada75c11acd5e67a90c3'
AND (
token = 'qiLTCTUMtRV6Sf9TGeSMIAosFRsc8qpG53cGCL53GSk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)