UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sQB2z7+kgtBiOr1goUl4LmkI3OJs8BIRABPs+5Z9aj4='
WHERE
key_id = '83185258ab89dfa600814245d38e4a7e898281cbfb8ccfe5a57d63412f75cafa'
AND (
token = 'sQB2z7+kgtBiOr1goUl4LmkI3OJs8BIRABPs+5Z9aj4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)