UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UhoLQYZIJ2Q1H/PT/LkFbdw4W37RQA7SdZW5VxqIo9M=' 
WHERE 
  key_id = '8ccca921246eb2c600bc83414511f5f51aeed316e52ff4dd74bb458987ee0c47' 
  AND (
    token = 'UhoLQYZIJ2Q1H/PT/LkFbdw4W37RQA7SdZW5VxqIo9M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032