UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MhB2YgVB9zIMnLvjNlh7JOPHc3xReT5E/mxnBSskfzA='
WHERE
key_id = '4b584c063c4758087e59aa3c354a1b37854697ebb4964e111fd5927dc666a690'
AND (
token = 'MhB2YgVB9zIMnLvjNlh7JOPHc3xReT5E/mxnBSskfzA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)