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