UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2r7a4PCTAxlBrNogSpjQyGnPPf1lYMpHvArdhik1Og8='
WHERE
key_id = 'd71134bcd550f2776ed4221fd2c3066c033802a18395a97cdbc086fd2718a758'
AND (
token = '2r7a4PCTAxlBrNogSpjQyGnPPf1lYMpHvArdhik1Og8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)