UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+F2NyFSDLjLvdRsBI516E4qVH0pJB8qM5z6Xbff7+9o='
WHERE
key_id = 'ed95a318a72998497628ec459f50f07902f5a0e3c7a0d106e9aaa94567d6047b'
AND (
token = '+F2NyFSDLjLvdRsBI516E4qVH0pJB8qM5z6Xbff7+9o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)