UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sj8Jywnujt8TlNZrJzDcd2fH4ysqNmis18K7NdSMFU4='
WHERE
key_id = '5618aef85e3eaefe57858fd18046ed2b684411ab0fd02516a2b1d529ef1dbaee'
AND (
token = 'sj8Jywnujt8TlNZrJzDcd2fH4ysqNmis18K7NdSMFU4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)