UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S940vNHR5hbgpW4+4JpDv8RnAl3qe0B69hkxInzPxHg='
WHERE
key_id = '4bdcbd603042efe4180cb2825400fd857344ee31ad5dd0ba0f5baf4a733cc012'
AND (
token = 'S940vNHR5hbgpW4+4JpDv8RnAl3qe0B69hkxInzPxHg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)