UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aBiH0/JiIvy/pMj6rMTCrPDiEPoAYFIDqKiljB6WBI4='
WHERE
key_id = 'cdfafbf060b4df8ca483397467b0ab354734e37f5b7e8da608f0e69510da0424'
AND (
token = 'aBiH0/JiIvy/pMj6rMTCrPDiEPoAYFIDqKiljB6WBI4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)